package org.zjh.controller.listener;

import org.zjh.controller.GameController;
import org.zjh.view.ui.GameUi;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @description: 游戏结算面板确定按钮监听
 * @author 郑佳豪
 * @date 2024/10/26 22:43
 * @version 1.0
 */
public class GameOverOkJbtList extends MouseAdapter {
    @Override
    public void mouseClicked(MouseEvent e) {
        gameInit();
    }

    /**
     * 游戏初始化
     */
    private void gameInit() {
        GameUi.gameOverFrame.dispose();
        GameUi.gameFrame.dispose();
        GameUi.gameFrame = null;
        GameUi.gameOverFrame = null;

        GameController gameController = GameController.getInstance();
        gameController.setComputerA(null);
        gameController.setComputerB(null);
        gameController.setCallPointCurrentPlayer(null);
        gameController.setLandOwnerPlayer(null);
        gameController.setCurDiscardPokerPlayer(null);
        gameController.setCurrentPokerIndex(0);
        gameController.getPokerBoxList().clear();
        gameController.getLandOwnerPokerList().clear();
        gameController.getNowDeskPokerList().clear();
    }
}
